package com.certification.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.certification.entity.CertReject;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * @author copa
 * @createDate 2022-03-29 16:36
 * @function
 */
@Repository
public interface CertRejectMapper extends BaseMapper<CertReject> {

    @Select("SELECT cr.reason FROM cert_reject cr LEFT JOIN certification c ON cr.cert_id = c.id " +
            "WHERE c.principal_id = #{userId} ORDER BY cr.id DESC LIMIT 1")
    String selectLastReject(Integer userId);
}
